package BtoB.util;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProcessXMLHelper {
	
    public static Map<String,ItemValueObject> getOrderSummary() {
    	Map<String,ItemValueObject> items = new HashMap<String, ItemValueObject>();
    	SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    	String date = sdf.format(new Date());
        DOMParser domParser = new DOMParser(items);
        domParser.parseXMLFiles(generateFileList(date));

        return items;
    }
	 private static List<String> generateFileList(String date){
     	String filePath = BtoBConstants.POFILERELATIVEPATH + date;
     	List<String> fileList = new ArrayList<String>();
     	File dir = new File(filePath);     
     	String[] strList = dir.list();
     	for(int i=0; i<strList.length;i++){
     		fileList.add(dir.getAbsolutePath()+"\\"+ strList[i]);
     	}
     	return fileList;
	 }
}
